#define _CRT_SECURE_NO_WARNINGS 1
#include<iostream>
#include<vector>
using namespace std;
class Solution
{
public:
    vector<int> missingTwo(vector<int>& nums)
    {
        int sum;
        for (int i = 1;i <= nums.size() + 2;i++)
            sum ^= i;
        for (auto& e : nums)
            sum ^= e;
        int k = 0;
        for (int i = 0;i < 32;i++)
        {
            if (((sum >> i) & 1) == 1)
            {
                k = i;
                break;
            }
        }
        int ret1=0, ret2=0;
        for (int i = 1;i <= nums.size() + 2;i++)
        {
            if (((i >> k) & 1) == 1) ret1 ^= i;
            else ret2 ^= i;
        }

        for (auto& e : nums)
        {
            if (((e >> k) & 1) == 1) ret1 ^= e;
            else ret2 ^= e;
        }

        return { ret1,ret2 };
    }
};
int main()
{
	vector<int> v = { 2 };
    Solution().missingTwo(v);
	return 0;
}